home *** CD-ROM | disk | FTP | other *** search
/ Internet News 2001 December / Internet News 2001-12 - CD-ROM.rar / INCD200112.ISO / Windows / Browser / Internet Explorer 6 / English / iew2k_3.cab / shdoclc.dll / HTML / PREVIEW.DLG < prev    next >
Text File  |  2001-08-17  |  42KB  |  1,692 lines

  1. <HTML XMLNS:IE>
  2. <HEAD>
  3. <?import namespace="ie" implementation="#default">
  4. <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
  5. <TITLE>Print Preview</TITLE>
  6. <STYLE>
  7. .divPage
  8. {
  9. position: absolute;
  10. top: -20000px;
  11. border-left: 1 solid black;
  12. border-top: 1 solid black;
  13. border-right: 4 solid black;
  14. border-bottom: 4 solid black;
  15. }
  16. .page
  17. {
  18. background: white;
  19. width: 8.5in;
  20. height: 11in;
  21. margin: 0px;
  22. overflow: hidden;
  23. }
  24. .mRect
  25. {
  26. position: absolute;
  27. margin: 1in;
  28. width: 6.5in;
  29. height: 9in;
  30. border: none;
  31. overflow : hidden;
  32. }
  33. .divHead
  34. {
  35. position: absolute;
  36. overflow: hidden;
  37. top: 0in;
  38. left: 0in;
  39. width: 8.5in;
  40. }
  41. .divFoot
  42. {
  43. position: absolute;
  44. overflow: hidden;
  45. bottom: 0in;
  46. left: 0in;
  47. width: 8.5in;
  48. }
  49. BODY { overflow: hidden; padding: 0; margin: 0; background: threedface; }
  50. TABLE { margin: 0px; padding: 0px; background: threedface; }
  51. .THeader { border: none; background: white; color: black; }
  52. .TFooter { border: none; background: white; color: black; }
  53. TD { padding: 0; margin: 0; border: none; }
  54. TD.UIPane { width: 20px; border: none; font-family: 'ms sans serif'; font-size: 8pt; }
  55. TD.UISeparator { width: 1px; border-left: 2px threedhighlight ridge; }
  56. BUTTON { border: 1px solid threedface; background: threedface; font-family: 'ms sans serif'; font-size: 8pt; color: buttontext;}
  57. </STYLE>
  58. <SCRIPT DEFER>
  59. var g_aDocTree = new Object();
  60. var g_nDispPage = -1;
  61. var g_nZoomFactor = 0;
  62. var g_cLeftToPrint = 0;
  63. var g_fRTL;
  64. var g_fPreview;
  65. var g_fDelayClose = false;
  66. var g_nMarginTop = 0;
  67. var g_nMarginBottom = 0;
  68. var g_nMarginLeft = 0;
  69. var g_nMarginRight = 0;
  70. var g_nPageWidth = 0;
  71. var g_nPageHeight = 0;
  72. var g_nUnprintTop = 0;
  73. var g_nUnprintBottom = 0;
  74. var g_strHeader = "";
  75. var g_strFooter = "";
  76. var g_fTableOfLinks = false;
  77. var g_cPagesDisplayed = 0;
  78. var g_cxDisplaySlots = 1;
  79. var g_cyDisplaySlots = 1;
  80. var g_imgUnderMouse = null;
  81. var g_nFramesetLayout = 0;
  82. var g_strActiveFrame = null;
  83. var g_nTotalPages = 0;
  84. var g_nDocsToCalc = 0;
  85. var g_nFramesLeft = 0;
  86. function GetRuleFromSelector(strSelector)
  87. {
  88. var i;
  89. var oRule;
  90. var oSS = document.styleSheets[0];
  91. for (i=0;;i++)
  92. {
  93. oRule = oSS.rules[i];
  94. if (oRule == null)
  95. break;
  96. if (oRule.selectorText == strSelector)
  97. break;
  98. }
  99. return oRule;
  100. }
  101. function UnprintableURL(strLink)
  102. {
  103. var fUnprintable = false;
  104. var cIndex;
  105. cIndex = strLink.indexOf(":");
  106. switch (cIndex)
  107. {
  108. case 4:
  109. if (strLink.substr(0, cIndex) == "news")
  110. fUnprintable = true;
  111. break;
  112. case 5:
  113. if (strLink.substr(0, cIndex) == "snews")
  114. fUnprintable = true;
  115. break;
  116. case 6:
  117. if ( strLink.substr(0, cIndex) == "telnet"
  118. || strLink.substr(0, cIndex) == "mailto")
  119. fUnprintable = true;
  120. break;
  121. case 8:
  122. if (strLink.substr(0,cIndex) == "vbscript")
  123. fUnprintable = true;
  124. break;
  125. case 10:
  126. if (strLink.substr(0,cIndex) == "javascript")
  127. fUnprintable = true;
  128. break;
  129. }
  130. return fUnprintable;
  131. }
  132. function OnKeyPress()
  133. {
  134. if (event.keyCode == 27)
  135. {
  136. Close();
  137. }
  138. }
  139. function OnKeyDown()
  140. {
  141. if (event.altKey)
  142. {
  143. switch (event.keyCode)
  144. {
  145. case 37:
  146. ChangeDispPage(g_nDispPage-1);
  147. break;
  148. case 39:
  149. ChangeDispPage(g_nDispPage+1);
  150. break;
  151. case 107:
  152. case 187:
  153. HandleZoom(-1);
  154. break;
  155. case 109:
  156. case 189:
  157. HandleZoom(1);
  158. break;
  159. case 35:
  160. HandleLastPage();
  161. break;
  162. case 36:
  163. HandleFirstPage();
  164. break;
  165. }
  166. }
  167. }
  168. function ShowHelp()
  169. {
  170. window.showHelp("iexplore.chm::/print_preview.htm");
  171. }
  172. function AttachDialogEvents()
  173. {
  174. butPrint.onclick = HandlePrintClick;
  175. butPageSetup.onclick = HandlePageSetup;
  176. butFirstPage.onclick = HandleFirstPage;
  177. butBackPage.onclick = HandleBackPage;
  178. butNextPage.onclick = HandleForwardPage;
  179. butLastPage.onclick = HandleLastPage;
  180. butZoomIn.onclick = HandleZoomInButton;
  181. butZoomOut.onclick = HandleZoomOutButton;
  182. butClose.onclick = Close;
  183. butHelp.onclick = ShowHelp;
  184. document.onhelp = ShowHelp;
  185. butPrint.onmousedown = buttonDown;
  186. butPageSetup.onmousedown = buttonDown;
  187. butFirstPage.onmousedown = buttonDown;
  188. butBackPage.onmousedown = buttonDown;
  189. butNextPage.onmousedown = buttonDown;
  190. butLastPage.onmousedown = buttonDown;
  191. butZoomIn.onmousedown = buttonDown;
  192. butZoomOut.onmousedown = buttonDown;
  193. butClose.onmousedown = buttonDown;
  194. butHelp.onmousedown = buttonDown;
  195. printCtl.onmouseover = buttonOver;
  196. printCtl.onmouseout = buttonOut;
  197. begin.onmouseover = buttonOver;
  198. begin.onmouseout = buttonOut;
  199. prev.onmouseover = buttonOver;
  200. prev.onmouseout = buttonOut;
  201. next.onmouseover = buttonOver;
  202. next.onmouseout = buttonOut;
  203. end.onmouseover = buttonOver;
  204. end.onmouseout = buttonOut;
  205. zoomIn.onmouseover = buttonOver;
  206. zoomIn.onmouseout = buttonOut;
  207. zoomOut.onmouseover = buttonOver;
  208. zoomOut.onmouseout = buttonOut;
  209. butPrint.onmouseover = new Function("buttonRaise(this);");
  210. butPrint.onmouseout = new Function("buttonLower(this);");
  211. butClose.onmouseover = new Function("buttonRaise(this);");
  212. butClose.onmouseout = new Function("buttonLower(this);");
  213. butHelp.onmouseover = new Function("buttonRaise(this);");
  214. butHelp.onmouseout = new Function("buttonLower(this);");
  215. inputPageNum.onkeypress = HandleInputKeyPress;
  216. inputPageNum.onchange = HandlePageSelect;
  217. selectZoom.onchange = HandleZoomSelect;
  218. selectFrameset.onchange = HandleFramesetSelect;
  219. window.onresize = OnResizeBody;
  220. window.onerror = HandleError;
  221. window.onfocus = new Function("MasterContainer.focus()");
  222. document.body.onkeypress = OnKeyPress;
  223. document.body.onkeydown = OnKeyDown;
  224. }
  225. function OnLoadBody()
  226. {
  227. g_fRTL = (document.body.currentStyle.direction.toLowerCase() == "rtl");
  228. g_fPreview = dialogArguments.__IE_PrintType == "Preview";
  229. if (UnprintableURL(dialogArguments.__IE_ContentDocumentUrl))
  230. {
  231. var L_Invalid_Text = "Unable to print URL. Please navigate directly to this page and select Print.";
  232. alert(L_Invalid_Text);
  233. window.close();
  234. }
  235. var str;
  236. str = begin.src;
  237. begin.base = str.slice(str.lastIndexOf("/")+1,str.indexOf("_"));
  238. str = end.src;
  239. end.base = str.slice(str.lastIndexOf("/")+1,str.indexOf("_"));
  240. str = next.src;
  241. next.base = str.slice(str.lastIndexOf("/")+1,str.indexOf("_"));
  242. str = prev.src;
  243. prev.base = str.slice(str.lastIndexOf("/")+1,str.indexOf("_"));
  244. ChangeZoom(75);
  245. if (dialogArguments.__IE_HeaderString)
  246. Printer.header = dialogArguments.__IE_HeaderString
  247. if (dialogArguments.__IE_FooterString)
  248. Printer.footer = dialogArguments.__IE_FooterString
  249. EnsureDocuments();
  250. window.document.body.style.cursor="wait";
  251. CreateDocument("document", "C", true);
  252. ChangeDispPage(1);
  253. g_nFramesLeft = 1;
  254. OnBuildAllFrames("C");
  255. if (g_fPreview)
  256. {
  257. AttachDialogEvents();
  258. OverflowContainer.style.top = idDivToolbar.offsetHeight;
  259. OverflowContainer.style.height = document.body.clientHeight - idDivToolbar.offsetHeight;
  260. }
  261. else
  262. {
  263. PrintNow(dialogArguments.__IE_PrintType == "Prompt");
  264. }
  265. }
  266. function BuildAllFramesComplete()
  267. {
  268. ;
  269. window.document.body.style.cursor="auto";
  270. UpdateFramesetSelect();
  271. }
  272. function CalcDocsComplete()
  273. {
  274. ;
  275. if (g_nFramesetLayout == 2)
  276. {
  277. ChangeFramesetLayout(g_nFramesetLayout, true)
  278. }
  279. }
  280. function OnResizeBody()
  281. {
  282. OverflowContainer.style.height = Math.max(0, document.body.clientHeight - idDivToolbar.offsetHeight);
  283. HandleDynamicZoom();
  284. PositionPages(g_nDispPage);
  285. }
  286. function HandleError(message, url, line)
  287. {
  288. var L_Internal_ErrorMessage = "There was an internal error, and Internet Explorer is unable to print this document.";
  289. alert(L_Internal_ErrorMessage);
  290. window.close();
  291. return true;
  292. }
  293. function OnRectComplete( strDoc )
  294. {
  295. if (!g_aDocTree[strDoc])
  296. {
  297. HandleError("Document " + strDoc + " does not exist.", document.URL, "OnRectComplete");
  298. return;
  299. }
  300. window.setTimeout("OnRectCompleteNext('" + strDoc + "', " + event.contentOverflow + ",'" + event.srcElement.id + "');", 25);
  301. }
  302. function OnRectCompleteNext( strDoc, fOverflow, strElement)
  303. {
  304. g_aDocTree[strDoc].RectComplete(fOverflow, strElement);
  305. }
  306. function enableButton(btn, img)
  307. {
  308. btn.disabled = false;
  309. if (g_imgUnderMouse == img)
  310. {
  311. img.src = img.base + "_hilite.gif";
  312. buttonRaise(btn);
  313. }
  314. else
  315. {
  316. img.src = img.base + ".gif";
  317. buttonLower(btn);
  318. }
  319. }
  320. function disableButton(btn, img)
  321. {
  322. btn.disabled = true;
  323. buttonLower(btn);
  324. if (img != null)
  325. {
  326. img.src = img.base + "_inactive.gif";
  327. }
  328. }
  329. function updateNavButtons()
  330. {
  331. if (g_nDispPage == 1)
  332. {
  333. disableButton(butFirstPage, begin);
  334. disableButton(butBackPage, prev);
  335. }
  336. else
  337. {
  338. enableButton(butFirstPage, begin);
  339. enableButton(butBackPage, prev);
  340. }
  341. if (TotalDisplayPages() - g_nDispPage < g_cxDisplaySlots * g_cyDisplaySlots)
  342. {
  343. disableButton(butNextPage, next);
  344. disableButton(butLastPage, end);
  345. }
  346. else
  347. {
  348. enableButton(butNextPage, next);
  349. enableButton(butLastPage, end);
  350. }
  351. }
  352. function updateZoomButtons()
  353. {
  354. var fZoomOutDisabled = false;
  355. var fZoomInDisabled = false;
  356. var oOptions = selectZoom.options;
  357. if (g_nZoomFactor >= parseInt(oOptions[0].value))
  358. {
  359. disableButton(butZoomIn, null);
  360. zoomIn.src = "zoom_inactive.gif";
  361. fZoomInDisabled = true;
  362. }
  363. else if (g_nZoomFactor <= parseInt(oOptions[oOptions.length-1-3].value))
  364. {
  365. disableButton(butZoomOut, null);
  366. zoomOut.src = "zoom_inactive.gif";
  367. fZoomOutDisabled = true;
  368. }
  369. if (!fZoomOutDisabled)
  370. {
  371. enableButton(butZoomOut, zoomOut);
  372. }
  373. if (!fZoomInDisabled)
  374. {
  375. enableButton(butZoomIn, zoomIn);
  376. }
  377. }
  378. function UpdateFramesetSelect()
  379. {
  380. if ( g_aDocTree["C"]._fFrameset )
  381. {
  382. if (!g_strActiveFrame)
  383. {
  384. selectFrameset.options.remove(1);
  385. }
  386. separatorFrameset.style.display = "inline";
  387. cellFrameset.style.display = "inline";
  388. }
  389. }
  390. function getPageWidth()
  391. {
  392. return g_aDocTree["C"].Page(1).offsetWidth;
  393. }
  394. function getPageHeight()
  395. {
  396. return g_aDocTree["C"].Page(1).offsetHeight;
  397. }
  398. function UndisplayPages()
  399. {
  400. while (g_cPagesDisplayed > 0)
  401. {
  402. var oPage = DisplayPage(g_nDispPage + g_cPagesDisplayed - 1);
  403. if (oPage != null)
  404. {
  405. oPage.style.top = "-20000px";
  406. if (g_fRTL)
  407. oPage.style.right = "10px";
  408. else
  409. oPage.style.left = "10px";
  410. }
  411. g_cPagesDisplayed--;
  412. }
  413. }
  414. function PositionPages(nDispPage)
  415. {
  416. var strDispDoc = DisplayDocument(nDispPage);
  417. if ( g_aDocTree != null
  418. && g_aDocTree[strDispDoc] != null
  419. && g_aDocTree[strDispDoc].Pages() > 0)
  420. {
  421. UndisplayPages();
  422. var xPageWidth = getPageWidth();
  423. var yPageHeight = getPageHeight();
  424. var nMaxPage = TotalDisplayPages();
  425. g_cxDisplaySlots = Math.max(1, Math.floor((OverflowContainer.offsetWidth*100)/(g_nZoomFactor*(xPageWidth+10))));
  426. g_cyDisplaySlots = Math.max(1, Math.floor((OverflowContainer.offsetHeight*100)/(g_nZoomFactor*(yPageHeight+10))));
  427. var nMaxPageRequest = Math.max(nMaxPage - g_cxDisplaySlots * g_cyDisplaySlots + 1, 1);
  428. if ( nDispPage < 1 )
  429. nDispPage = 1;
  430. else if (nDispPage > nMaxPageRequest)
  431. nDispPage = nMaxPageRequest;
  432. g_nDispPage = nDispPage;
  433. document.all.spanPageTotal.innerText = nMaxPage;
  434. document.all.inputPageNum.value = g_nDispPage;
  435. updateNavButtons();
  436. var xDisplaySlot = 1;
  437. var yDisplaySlot = 1;
  438. var iPage = g_nDispPage;
  439. g_cPagesDisplayed = 0;
  440. while (iPage <= nMaxPage && yDisplaySlot <= g_cyDisplaySlots)
  441. {
  442. var xPos = xDisplaySlot*10 + (xDisplaySlot-1)*xPageWidth;
  443. var yPos = yDisplaySlot*10 + (yDisplaySlot-1)*yPageHeight;
  444. var oPage = DisplayPage(iPage);
  445. if (g_fRTL)
  446. oPage.style.right = xPos;
  447. else
  448. oPage.style.left = xPos;
  449. oPage.style.top = yPos;
  450. iPage++;
  451. if (++xDisplaySlot > g_cxDisplaySlots)
  452. {
  453. xDisplaySlot = 1;
  454. yDisplaySlot++;
  455. }
  456. g_cPagesDisplayed++;
  457. }
  458. }
  459. }
  460. function ChangeDispPage(nDispPageNew)
  461. {
  462. if (isNaN(nDispPageNew))
  463. {
  464. inputPageNum.value = g_nDispPage;
  465. }
  466. else
  467. {
  468. if (nDispPageNew < 1)
  469. nDispPageNew = 1;
  470. else if (nDispPageNew > TotalDisplayPages())
  471. nDispPageNew = TotalDisplayPages();
  472. OverflowContainer.scrollTop = 0;
  473. PositionPages(nDispPageNew);
  474. }
  475. return g_nDispPage;
  476. }
  477. function DisplayDocument(nWhichPage)
  478. {
  479. switch (g_nFramesetLayout)
  480. {
  481. case 0:
  482. return "C";
  483. break;
  484. case 1:
  485. return g_strActiveFrame;
  486. break;
  487. case 2:
  488. var i;
  489. if (!nWhichPage)
  490. return null;
  491. ;
  492. for (i in g_aDocTree)
  493. {
  494. if ( nWhichPage >= g_aDocTree[i]._nStartingPage
  495. && nWhichPage < (g_aDocTree[i]._nStartingPage + g_aDocTree[i].Pages()))
  496. return i;
  497. }
  498. default:
  499. HandleError("Display document cannot be found!", document.URL, "DisplayDocument");
  500. }
  501. }
  502. function TotalDisplayPages()
  503. {
  504. if (g_nFramesetLayout == 2)
  505. return g_nTotalPages;
  506. return g_aDocTree[DisplayDocument()].Pages();
  507. }
  508. function DisplayPage(nWhichPage)
  509. {
  510. ;
  511. if (g_nFramesetLayout != 2)
  512. return g_aDocTree[DisplayDocument(nWhichPage)].Page(nWhichPage);
  513. return g_aDocTree[DisplayDocument(nWhichPage)].Page(nWhichPage - g_aDocTree[DisplayDocument(nWhichPage)]._nStartingPage + 1);
  514. }
  515. function ChangeZoom(nNewVal)
  516. {
  517. if (nNewVal < 10)
  518. nNewVal = 10;
  519. else if (nNewVal > 1000)
  520. nNewVal = 1000;
  521. else if (isNaN(nNewVal))
  522. nNewVal = g_nZoomFactor;
  523. if (nNewVal != g_nZoomFactor)
  524. {
  525. MasterContainer.style.zoom = nNewVal + "%";
  526. g_nZoomFactor = nNewVal;
  527. updateZoomButtons();
  528. PositionPages(g_nDispPage);
  529. }
  530. return g_nZoomFactor;
  531. }
  532. function BuildTableOfLinks( docSource )
  533. {
  534. var aLinks = docSource.links;
  535. var nLinks = aLinks.length;
  536. if (nLinks > 0)
  537. {
  538. var fDuplicate;
  539. var i;
  540. var j;
  541. var newHTM;
  542. var docLinkTable = document.createElement("BODY");
  543. var L_LINKSHEADER1_Text = "Shortcut Text";
  544. var L_LINKSHEADER2_Text = "Internet Address";
  545. newHTM = "<CENTER><TABLE BORDER=1>";
  546. newHTM += "<THEAD style=\"display:table-header-group\"><TR><TH>"
  547. + L_LINKSHEADER1_Text
  548. + "</TH><TH>" + L_LINKSHEADER2_Text + "</TH></TR></THEAD><TBODY>";
  549. for (i = 0; i < nLinks; i++)
  550. {
  551. fDuplicate = false;
  552. for (j = 0; (!fDuplicate) && (j < i); j++)
  553. {
  554. if (aLinks[i].href == aLinks[j].href)
  555. fDuplicate = true;
  556. }
  557. if (!fDuplicate)
  558. newHTM += ("<TR><TD>" + aLinks[i].innerText + "</TD><TD>" + aLinks[i].href + "</TD></TR>");
  559. }
  560. newHTM += "</TBODY></TABLE></CENTER>";
  561. docLinkTable.innerHTML = newHTM;
  562. return docLinkTable.document;
  563. }
  564. return null;
  565. }
  566. function CreateDocument( docURL, strDocID, fUseStreamHeader )
  567. {
  568. if (g_aDocTree[strDocID])
  569. return;
  570. g_aDocTree[strDocID] = new CPrintDoc( strDocID, docURL );
  571. g_aDocTree[strDocID].InitDocument( fUseStreamHeader );
  572. }
  573. function ChangeFramesetLayout( nNewLayout, fForce )
  574. {
  575. if ( g_nFramesetLayout == nNewLayout
  576. && !fForce)
  577. return;
  578. UndisplayPages();
  579. g_nFramesetLayout = nNewLayout;
  580. switch ( nNewLayout )
  581. {
  582. case 0:
  583. case 1:
  584. break;
  585. case 2:
  586. g_nTotalPages = 0;
  587. for (i in g_aDocTree)
  588. {
  589. if ( g_aDocTree[i]._fFrameset
  590. || i == "S")
  591. g_aDocTree[i]._nStartingPage = 0;
  592. else
  593. {
  594. g_aDocTree[i]._nStartingPage = g_nTotalPages + 1;
  595. g_nTotalPages += g_aDocTree[i].Pages();
  596. }
  597. }
  598. break;
  599. default:
  600. HandleError("Impossible frameset layout type: " + nNewLayout, document.URL, "ChangeFramesetLayout");
  601. }
  602. ChangeDispPage(1);
  603. }
  604. function EnsureDocuments()
  605. {
  606. var i;
  607. var tmp;
  608. var top = Printer.marginTop / 100;
  609. var bottom = Printer.marginBottom / 100;
  610. var left = Printer.marginLeft / 100;
  611. var right = Printer.marginRight / 100;
  612. var pageWidth = Printer.pageWidth / 100;
  613. var pageHeight = Printer.pageHeight / 100;
  614. var linktable = Printer.tableOfLinks;
  615. var upTop = Printer.unprintableTop / 100;
  616. var upBottom = Printer.unprintableBottom / 100;
  617. var header = Printer.header;
  618. var footer = Printer.footer;
  619. if (header)
  620. {
  621. tmp = upTop + (27 / 100);
  622. if (tmp > top)
  623. top = tmp;
  624. }
  625. if (footer)
  626. {
  627. tmp = upBottom + (27 / 100);
  628. if (tmp > bottom)
  629. bottom = tmp;
  630. }
  631. if (upTop != g_nUnprintTop)
  632. {
  633. g_nUnprintTop = upTop;
  634. oRule = GetRuleFromSelector(".divHead");
  635. if (oRule == null)
  636. {
  637. HandleError("'.divHead' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  638. }
  639. oRule.style.top = upTop + "in";
  640. }
  641. if (upBottom != g_nUnprintBottom)
  642. {
  643. g_nUnprintBottom= upBottom;
  644. oRule = GetRuleFromSelector(".divFoot");
  645. if (oRule == null)
  646. {
  647. HandleError("'.divFoot' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  648. }
  649. oRule.style.bottom = upBottom + "in";
  650. }
  651. if ( top != g_nMarginTop
  652. || bottom != g_nMarginBottom
  653. || left != g_nMarginLeft
  654. || right != g_nMarginRight
  655. || pageWidth != g_nPageWidth
  656. || pageHeight != g_nPageHeight
  657. || header != g_strHeader
  658. || footer != g_strFooter )
  659. {
  660. var conWidth = pageWidth - left - right;
  661. var conHeight = pageHeight - top - bottom;
  662. var oStyleSheet = document.styleSheets[0];
  663. var oRule;
  664. if (conWidth < 0)
  665. conWidth = 0;
  666. if (conHeight < 0)
  667. conHeight = 0;
  668. UndisplayPages();
  669. g_nTotalPages = 0;
  670. g_nDocsToCalc = 0;
  671. for (i in g_aDocTree)
  672. {
  673. g_nDocsToCalc++;
  674. g_aDocTree[i].ResetDocument();
  675. }
  676. g_nMarginTop = top;
  677. g_nMarginBottom = bottom;
  678. g_nMarginLeft = left;
  679. g_nMarginRight = right;
  680. g_nPageWidth = pageWidth;
  681. g_nPageHeight = pageHeight;
  682. g_fTableofLinks = linktable;
  683. g_strHeader = header;
  684. g_strFooter = footer;
  685. HeadFoot.textHead = g_strHeader;
  686. HeadFoot.textFoot = g_strFooter;
  687. oRule = GetRuleFromSelector(".page");
  688. if (oRule == null)
  689. {
  690. HandleError("'.page' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  691. }
  692. oRule.style.width = pageWidth + "in";
  693. oRule.style.height = pageHeight + "in";
  694. oRule = GetRuleFromSelector(".mRect");
  695. if (oRule == null)
  696. {
  697. HandleError("'.mRect' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  698. }
  699. oRule.style.marginLeft = left + "in";
  700. oRule.style.marginRight = right + "in";
  701. oRule.style.marginTop = top + "in";
  702. oRule.style.marginBottom = bottom + "in";
  703. oRule.style.width = conWidth + "in";
  704. oRule.style.height = conHeight + "in";
  705. oRule = GetRuleFromSelector(".divHead");
  706. if (oRule == null)
  707. {
  708. HandleError("'.divHead' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  709. }
  710. oRule.style.left = left + "in";
  711. oRule.style.width = conWidth + "in";
  712. oRule = GetRuleFromSelector(".divFoot");
  713. if (oRule == null)
  714. {
  715. HandleError("'.divHead' rule does not exist!", document.URL, "CPrintDoc::EnsureDocuments");
  716. }
  717. oRule.style.left = left + "in";
  718. oRule.style.width = conWidth + "in";
  719. for (i in g_aDocTree)
  720. {
  721. g_aDocTree[i].InitDocument((g_aDocTree[i]._anMerge[1] == 1));
  722. }
  723. if (g_nFramesetLayout == 2)
  724. ChangeFramesetLayout(g_nFramesetLayout, true);
  725. PositionPages(g_nDispPage);
  726. }
  727. else if (linktable != g_fTableOfLinks)
  728. {
  729. g_fTableOfLinks = linktable;
  730. for (i in g_aDocTree)
  731. {
  732. g_aDocTree[i].ResetTableOfLinks();
  733. }
  734. }
  735. }
  736. function buttonRaise( elem )
  737. {
  738. elem.style.borderStyle = "outset";
  739. elem.style.borderColor = "threedhighlight";
  740. }
  741. function buttonLower( elem )
  742. {
  743. elem.style.borderStyle = "solid";
  744. elem.style.borderColor = "threedface";
  745. }
  746. function buttonDepress(elem)
  747. {
  748. elem.style.borderStyle = "inset";
  749. elem.style.borderColor = "threedshadow";
  750. }
  751. function buttonOver()
  752. {
  753. var imgSrc = event.srcElement;
  754. g_imgUnderMouse = imgSrc;
  755. if (imgSrc == begin ||
  756. imgSrc == prev ||
  757. imgSrc == next ||
  758. imgSrc == end)
  759. {
  760. updateNavButtons();
  761. }
  762. else if (imgSrc == zoomIn ||
  763. imgSrc == zoomOut)
  764. {
  765. updateZoomButtons();
  766. }
  767. else
  768. {
  769. imgSrc.src= "" + imgSrc.id + "_hilite.gif";
  770. buttonRaise( imgSrc.parentNode );
  771. }
  772. }
  773. function buttonOut()
  774. {
  775. var imgSrc = event.srcElement;
  776. g_imgUnderMouse = null;
  777. if (imgSrc == begin ||
  778. imgSrc == prev ||
  779. imgSrc == next ||
  780. imgSrc == end)
  781. {
  782. updateNavButtons();
  783. }
  784. else if (imgSrc == zoomIn ||
  785. imgSrc == zoomOut)
  786. {
  787. updateZoomButtons();
  788. }
  789. else
  790. {
  791. imgSrc.src= "" + imgSrc.id + ".gif";
  792. buttonLower( imgSrc.parentNode );
  793. }
  794. }
  795. function buttonDown()
  796. {
  797. buttonDepress(event.srcElement);
  798. }
  799. function HandlePageSelect()
  800. {
  801. event.srcElement.value = ChangeDispPage(parseInt(inputPageNum.value));
  802. MasterContainer.focus();
  803. }
  804. function HandlePageSetup()
  805. {
  806. if (Printer.showPageSetupDialog())
  807. EnsureDocuments();
  808. }
  809. function HandleForwardPage()
  810. {
  811. ChangeDispPage(g_nDispPage + 1);
  812. MasterContainer.focus();
  813. }
  814. function HandleBackPage()
  815. {
  816. ChangeDispPage(g_nDispPage - 1);
  817. MasterContainer.focus();
  818. }
  819. function HandleFirstPage()
  820. {
  821. ChangeDispPage(1);
  822. MasterContainer.focus();
  823. }
  824. function HandleLastPage()
  825. {
  826. ChangeDispPage(TotalDisplayPages());
  827. MasterContainer.focus();
  828. }
  829. function NumericFromSpecialZoom(fnBounder)
  830. {
  831. var iMaxNumericZoom = selectZoom.options.length-1-3;
  832. var iBelow = -1;
  833. var nBelow = 0;
  834. var iAbove = iMaxNumericZoom + 1;
  835. var i;
  836. for (i = 0; i <= iMaxNumericZoom; i++)
  837. {
  838. var nThisIndex = parseInt(selectZoom.options[i].value);
  839. if (nThisIndex >= g_nZoomFactor)
  840. {
  841. iBelow = i;
  842. nBelow = nThisIndex;
  843. }
  844. else
  845. {
  846. break;
  847. }
  848. }
  849. if (nBelow > g_nZoomFactor)
  850. {
  851. iAbove = iBelow + 1;
  852. }
  853. else
  854. {
  855. iAbove = iBelow;
  856. }
  857. return fnBounder(iBelow, iAbove);
  858. }
  859. function HandleZoom(nZoomIndexDelta)
  860. {
  861. var iCurrZoom = selectZoom.selectedIndex;
  862. var iMaxNumericZoom = selectZoom.options.length-1-3;
  863. if (iCurrZoom > iMaxNumericZoom)
  864. {
  865. var fnRemapBounder = null;
  866. if (nZoomIndexDelta == 1)
  867. {
  868. fnRemapBounder = Math.min;
  869. }
  870. else
  871. {
  872. fnRemapBounder = Math.max;
  873. }
  874. iCurrZoom = NumericFromSpecialZoom(fnRemapBounder);
  875. }
  876. selectZoom.selectedIndex = Math.min(Math.max(0, iCurrZoom + nZoomIndexDelta), iMaxNumericZoom);
  877. ChangeZoom(parseInt(selectZoom.options[selectZoom.selectedIndex].value));
  878. }
  879. function HandleDynamicZoom()
  880. {
  881. var nZoomType = parseInt(selectZoom.options[selectZoom.selectedIndex].value);
  882. if (nZoomType < 0)
  883. {
  884. var nZoomFactor = 100;
  885. var xPageWidth = getPageWidth();
  886. switch (nZoomType)
  887. {
  888. case -1:
  889. nZoomFactor = Math.floor(((OverflowContainer.offsetWidth - 20) * 100) / xPageWidth);
  890. break;
  891. case -2:
  892. var xZoom = Math.floor(((OverflowContainer.offsetWidth - 20) * 100) / xPageWidth);
  893. var yZoom = Math.floor(((OverflowContainer.offsetHeight - 20) * 100) / getPageHeight());
  894. nZoomFactor = Math.min(xZoom, yZoom);
  895. break;
  896. case -3:
  897. nZoomFactor = Math.floor(((OverflowContainer.offsetWidth - 30) * 100) / (2 * xPageWidth));
  898. break;
  899. default:
  900. nZoomFactor = 100;
  901. break;
  902. }
  903. ChangeZoom(nZoomFactor);
  904. }
  905. }
  906. function HandleZoomSelect()
  907. {
  908. var nZoomFactor = parseInt(selectZoom.options[selectZoom.selectedIndex].value);
  909. if (nZoomFactor < 0)
  910. {
  911. HandleDynamicZoom();
  912. }
  913. else
  914. {
  915. ChangeZoom(nZoomFactor);
  916. }
  917. }
  918. function HandleFramesetSelect()
  919. {
  920. ChangeFramesetLayout(parseInt(selectFrameset.options[selectFrameset.selectedIndex].value), false);
  921. }
  922. function HandleZoomInButton()
  923. {
  924. HandleZoom(-1);
  925. MasterContainer.focus();
  926. }
  927. function HandleZoomOutButton()
  928. {
  929. HandleZoom(1);
  930. MasterContainer.focus();
  931. }
  932. function HandleInputKeyPress()
  933. {
  934. var keyStroke = event.keyCode;
  935. if (keyStroke == 13)
  936. {
  937. event.srcElement.onchange();
  938. }
  939. else if (keyStroke < 48 || keyStroke > 57)
  940. {
  941. event.returnValue = false;
  942. }
  943. }
  944. function Close()
  945. {
  946. Printer.updatePageStatus(-1);
  947. if (g_fDelayClose)
  948. {
  949. g_fDelayClose = false;
  950. window.setTimeout("Close()", 120000);
  951. return;
  952. }
  953. window.close();
  954. }
  955. function PrintAll()
  956. {
  957. var i;
  958. var nFirstDoc;
  959. if ( g_nFramesLeft > 0
  960. && Printer.framesetDocument
  961. && !Printer.frameAsShown )
  962. {
  963. window.setTimeout("PrintAll()", 100);
  964. return;
  965. }
  966. EnsureDocuments();
  967. if (Printer.copies <= 0)
  968. {
  969. Close();
  970. }
  971. else if ( Printer.selectedPages
  972. && Printer.pageFrom > Printer.pageTo )
  973. {
  974. var L_PAGERANGE_ErrorMessage = "The 'From' value cannot be greater than the 'To' value.";
  975. alert(L_PAGERANGE_ErrorMessage);
  976. ;
  977. if (!g_fPreview)
  978. PrintNow(true);
  979. }
  980. else
  981. {
  982. g_cLeftToPrint = 1;
  983. Printer.updatePageStatus(1);
  984. PrintSentinel(((Printer.selection)
  985. ? "S"
  986. : (Printer.frameActive && !!g_strActiveFrame)
  987. ? g_strActiveFrame
  988. : "C"),
  989. true);
  990. }
  991. }
  992. function PrintSentinel( strDoc, fRecursionOK )
  993. {
  994. if ( !g_aDocTree[strDoc]
  995. || !g_aDocTree[strDoc].ReadyToPrint() )
  996. {
  997. window.setTimeout("PrintSentinel('" + strDoc + "'," + fRecursionOK + ");", 500);
  998. return;
  999. }
  1000. g_aDocTree[strDoc].Print(fRecursionOK);
  1001. }
  1002. function PrintDocumentComplete()
  1003. {
  1004. g_cLeftToPrint--;
  1005. if (g_cLeftToPrint <= 0)
  1006. {
  1007. Close();
  1008. }
  1009. }
  1010. function PrintNow( fWithPrompt)
  1011. {
  1012. if ( !g_aDocTree["C"]
  1013. || !g_aDocTree["C"]._aaRect[1][0]
  1014. || !g_aDocTree["C"]._aaRect[1][0].contentDocument.body)
  1015. {
  1016. window.setTimeout("PrintNow('" + fWithPrompt + "');", 100);
  1017. return;
  1018. }
  1019. var oDoc = g_aDocTree["C"]._aaRect[1][0].contentDocument;
  1020. var fConfirmed;
  1021. var fFramesetDocument = (oDoc.body.tagName.toUpperCase() == "FRAMESET");
  1022. var fActiveFrame = (oDoc.all.tags("HTML").item(0).__IE_ActiveFrame != null);
  1023. Printer.framesetDocument = fFramesetDocument;
  1024. Printer.frameActiveEnabled = fActiveFrame;
  1025. if (g_fPreview)
  1026. {
  1027. Printer.frameActive = (g_nFramesetLayout == 1);
  1028. Printer.frameAsShown = (g_nFramesetLayout == 0);
  1029. Printer.currentPageAvail = true;
  1030. }
  1031. else
  1032. {
  1033. Printer.frameActive = fActiveFrame;
  1034. Printer.frameAsShown = false;
  1035. Printer.currentPageAvail = false;
  1036. }
  1037. Printer.selectionEnabled = !!(dialogArguments.__IE_ContentSelectionUrl);
  1038. Printer.selection = false;
  1039. fConfirmed = (eval(fWithPrompt)) ? Printer.showPrintDialog() : Printer.ensurePrintDialogDefaults();
  1040. if ( fConfirmed )
  1041. {
  1042. if ( Printer.selection
  1043. && dialogArguments.__IE_ContentSelectionUrl )
  1044. {
  1045. CreateDocument(dialogArguments.__IE_ContentSelectionUrl, "S", true);
  1046. }
  1047. Printer.usePrinterCopyCollate = ( Printer.deviceSupports("copies") >= Printer.copies
  1048. && ( !Printer.collate
  1049. || Printer.deviceSupports("collate") ));
  1050. PrintAll();
  1051. }
  1052. else
  1053. {
  1054. if ( !g_fPreview )
  1055. {
  1056. Close();
  1057. }
  1058. else
  1059. {
  1060. Printer.tableoflinks = false;
  1061. }
  1062. }
  1063. }
  1064. function HandlePrintClick()
  1065. {
  1066. PrintNow(true, true);
  1067. }
  1068. function CPrintDoc_ReadyToPrint()
  1069. {
  1070. if ( this._nStatus == 4
  1071. && this._aaRect[1][0].contentDocument.readyState == "complete")
  1072. {
  1073. return true;
  1074. }
  1075. return false;
  1076. }
  1077. function CPrintDoc_Print( fRecursionOK )
  1078. {
  1079. if (!this.ReadyToPrint())
  1080. {
  1081. HandleError("Printing when not ready!", document.URL, "CPrintDoc::Print");
  1082. return;
  1083. }
  1084. var nCount = (Printer.usePrinterCopyCollate) ? 1 : Printer.copies;
  1085. var nFrom;
  1086. var nTo;
  1087. ;
  1088. if (fRecursionOK)
  1089. {
  1090. var fFrameset = (this._aaRect[1][0].contentDocument.body.tagName.toUpperCase() == "FRAMESET");
  1091. if (Printer.frameActive)
  1092. {
  1093. var n = parseInt(this._aaRect[1][0].contentDocument.all.tags("HTML").item(0).__IE_ActiveFrame);
  1094. if (n >= 0)
  1095. {
  1096. var oTargetFrame = (fFrameset)
  1097. ? this._aaRect[1][0].contentDocument.all.tags("FRAME").item(n)
  1098. : this._aaRect[1][0].contentDocument.all.tags("IFRAME").item(n);
  1099. if ( IsPersistedDoc()
  1100. && ( oTargetFrame.src == "res://SHDOCLC.DLL/printnof.htm"
  1101. || oTargetFrame.src == "about:blank" ))
  1102. {
  1103. Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, true);
  1104. }
  1105. else
  1106. {
  1107. this.CreateSubDocument(oTargetFrame.src, true);
  1108. this.PrintAllSubDocuments(true);
  1109. }
  1110. PrintDocumentComplete();
  1111. return;
  1112. }
  1113. }
  1114. if (fFrameset)
  1115. {
  1116. if (!Printer.frameAsShown)
  1117. {
  1118. this.PrintAllSubDocuments(true);
  1119. if (IsPersistedDoc())
  1120. {
  1121. Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, false);
  1122. }
  1123. PrintDocumentComplete();
  1124. return;
  1125. }
  1126. else
  1127. {
  1128. Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, false);
  1129. }
  1130. }
  1131. else
  1132. {
  1133. if (Printer.allLinkedDocuments)
  1134. {
  1135. this.BuildAllLinkedDocuments();
  1136. this.PrintAllSubDocuments(false);
  1137. }
  1138. }
  1139. }
  1140. if (Printer.printNonNative(this._aaRect[1][0].contentDocument) )
  1141. {
  1142. g_fDelayClose = !g_fPreview;
  1143. PrintDocumentComplete();
  1144. return;
  1145. }
  1146. if (Printer.selectedPages)
  1147. {
  1148. nFrom = Printer.pageFrom;
  1149. nTo = Printer.pageTo;
  1150. if (nFrom < 1)
  1151. nFrom = 1;
  1152. if (nTo > this.Pages())
  1153. nTo = this.Pages();
  1154. }
  1155. else if ( Printer.currentPage
  1156. && this._strDoc == DisplayDocument())
  1157. {
  1158. nFrom = (this.Pages() >= g_nDispPage) ? g_nDispPage : this.Pages();
  1159. nTo = nFrom;
  1160. }
  1161. else
  1162. {
  1163. nFrom = 1;
  1164. nTo = this.Pages();
  1165. }
  1166. if (nTo < nFrom)
  1167. {
  1168. PrintDocumentComplete();
  1169. return;
  1170. }
  1171. ;
  1172. ;
  1173. ;
  1174. if (Printer.startDoc(this._aaRect[1][0].contentDocument.URL))
  1175. {
  1176. if (Printer.collate)
  1177. {
  1178. var fExtraPage = ( Printer.duplex
  1179. && ((nFrom - nTo) % 2 == 0) );
  1180. for (j = 0; j < nCount; j++)
  1181. {
  1182. for (i = nFrom; i <= nTo; i++)
  1183. {
  1184. Printer.printPage(this.Page(i).children[0]);
  1185. }
  1186. if (fExtraPage)
  1187. Printer.printBlankPage();
  1188. }
  1189. }
  1190. else
  1191. {
  1192. var fDuplex = Printer.duplex;
  1193. for (i = nFrom; i <= nTo; i++)
  1194. {
  1195. for (j = 0; j < nCount; j++)
  1196. {
  1197. Printer.printPage(this.Page(i).children[0]);
  1198. if (fDuplex)
  1199. {
  1200. if (i < nTo)
  1201. Printer.printPage(this.Page(i+1));
  1202. else
  1203. Printer.printBlankPage();
  1204. }
  1205. }
  1206. if (fDuplex)
  1207. i++;
  1208. }
  1209. }
  1210. Printer.stopDoc();
  1211. }
  1212. PrintDocumentComplete();
  1213. }
  1214. function CPrintDoc_RectComplete(fOverflow, strElement)
  1215. {
  1216. var nStatus = parseInt(strElement.substr(5,1));
  1217. var nPage = parseInt(strElement.substr(strElement.lastIndexOf("p") + 1));
  1218. ;
  1219. ;
  1220. if (nStatus > this._nStatus)
  1221. return false;
  1222. if (nPage != this._acPage[nStatus] - 1 + this._anMerge[nStatus])
  1223. return false;
  1224. if (nStatus != this._nStatus)
  1225. {
  1226. if (!fOverflow)
  1227. return false;
  1228. this.StopFixupHF();
  1229. if (this._nStatus == 4)
  1230. g_nDocsToCalc++;
  1231. this._nStatus = nStatus;
  1232. }
  1233. if (fOverflow)
  1234. {
  1235. this.AddPage();
  1236. }
  1237. else
  1238. {
  1239. switch (this._nStatus)
  1240. {
  1241. case 0:
  1242. this._nStatus = 1;
  1243. this.AddFirstPage();
  1244. this._aaRect[this._nStatus][0].contentSrc = this._strDocURL;
  1245. break;
  1246. case 1:
  1247. this._nStatus = 2;
  1248. this.AddTableOfLinks();
  1249. break;
  1250. case 2:
  1251. this._nStatus = 3;
  1252. if (this._strDoc == DisplayDocument())
  1253. ChangeDispPage(g_nDispPage);
  1254. this.FixupHF();
  1255. break;
  1256. }
  1257. }
  1258. if (this._strDoc == DisplayDocument())
  1259. {
  1260. spanPageTotal.innerText = this.Pages();
  1261. updateNavButtons();
  1262. }
  1263. }
  1264. function CPrintDoc_AddPage()
  1265. {
  1266. var newHTM = "";
  1267. var aPage = this._aaPage[this._nStatus];
  1268. var aRect = this._aaRect[this._nStatus];
  1269. ;
  1270. (this._acPage[this._nStatus])++;
  1271. HeadFoot.URL = this.EnsureURL();
  1272. HeadFoot.title = this.EnsureTitle();
  1273. HeadFoot.pageTotal = this.Pages();
  1274. HeadFoot.page = HeadFoot.pageTotal;
  1275. if (this._acPage[this._nStatus] <= aPage.length)
  1276. {
  1277. var oPage = aPage[this._acPage[this._nStatus] - 1];
  1278. oPage.children("header").innerHTML = HeadFoot.HtmlHead;
  1279. oPage.children("footer").innerHTML = HeadFoot.HtmlFoot;
  1280. }
  1281. else
  1282. {
  1283. newHTM = "<DIV class=divPage><IE:DeviceRect media=\"print\" class=page id=mDiv" + this._nStatus + this._strDoc + "p" + aPage.length + ">";
  1284. newHTM += "<IE:LAYOUTRECT id=mRect" + this._nStatus + this._strDoc + "p" + aRect.length;
  1285. newHTM += " class=mRect nextRect=mRect" + this._nStatus + this._strDoc + "p" + (aRect.length + 1);
  1286. newHTM += " onlayoutcomplete=OnRectComplete('" + this._strDoc + "')";
  1287. newHTM += " tabindex=-1 onbeforefocusenter='event.returnValue=false;' ";
  1288. newHTM += " /><DIV class=divHead id=header>";
  1289. newHTM += HeadFoot.HtmlHead;
  1290. newHTM += "</DIV><DIV class=divFoot id=footer>";
  1291. newHTM += HeadFoot.HtmlFoot;
  1292. newHTM += " </DIV></IE:DeviceRect></DIV>";
  1293. MasterContainer.insertAdjacentHTML("beforeEnd", newHTM);
  1294. aPage[aPage.length] = eval( "document.all.mDiv" + this._nStatus + this._strDoc + "p" + aPage.length);
  1295. aRect[aRect.length] = eval("document.all.mRect" + this._nStatus + this._strDoc + "p" + aRect.length);
  1296. }
  1297. }
  1298. function CPrintDoc_AddFirstPage()
  1299. {
  1300. this._acPage[this._nStatus] = 0;
  1301. if (this._anMerge[this._nStatus] == 0)
  1302. {
  1303. this.AddPage();
  1304. }
  1305. else
  1306. {
  1307. var aRect = this._aaRect[this._nStatus];
  1308. var oPage = this._aaPage[this._nStatus - 1][this._acPage[this._nStatus - 1] - 1];
  1309. var oTop = this._aaRect[this._nStatus - 1][this._acPage[this._nStatus - 1] + this._anMerge[this._nStatus - 1] - 1];
  1310. var nTop = oTop.offsetTop + oTop.scrollHeight;
  1311. var nHeight = oTop.clientHeight - oTop.scrollHeight;
  1312. ;
  1313. ;
  1314. if (aRect.length > 0)
  1315. {
  1316. var oNode = aRect[0];
  1317. oNode.style.marginTop = nTop + "px";
  1318. oNode.style.pixelHeight = nHeight;
  1319. if (oNode.parentElement != oPage)
  1320. oPage.insertBefore(oNode);
  1321. }
  1322. else
  1323. {
  1324. var newHTM;
  1325. var oNode;
  1326. newHTM = "<IE:LAYOUTRECT id=mRect" + this._nStatus + this._strDoc + "p0";
  1327. newHTM += " class=mRect nextRect=mRect" + this._nStatus + this._strDoc + "p1";
  1328. newHTM += " onlayoutcomplete=OnRectComplete('" + this._strDoc + "')";
  1329. newHTM += " tabindex=-1 onbeforefocus='event.returnValue=false;' />";
  1330. oPage.insertAdjacentHTML("beforeEnd", newHTM);
  1331. oNode = eval("document.all.mRect" + this._nStatus + this._strDoc + "p0");
  1332. aRect[0] = oNode;
  1333. oNode.style.marginTop = nTop + "px";
  1334. oNode.style.height = nHeight + "px";
  1335. }
  1336. }
  1337. }
  1338. function CPrintDoc_InitDocument( fUseStreamHeader )
  1339. {
  1340. var fReallyUseStreamHeader = (fUseStreamHeader && (dialogArguments.__IE_OutlookHeader != null));
  1341. this._anMerge[1] = (fReallyUseStreamHeader) ? 1 : 0;
  1342. this._nStatus = (fReallyUseStreamHeader) ? 0 : 1;
  1343. this.AddFirstPage();
  1344. this._aaRect[this._nStatus][0].contentSrc = (fReallyUseStreamHeader)
  1345. ? dialogArguments.__IE_OutlookHeader
  1346. : this._strDocURL;
  1347. }
  1348. function CPrintDoc_PrintAllSubDocuments( fRecursionOK )
  1349. {
  1350. if (!this._aDoc)
  1351. return;
  1352. var nDocs = this._aDoc.length;
  1353. var i;
  1354. g_cLeftToPrint += nDocs;
  1355. for (i = 0; i < nDocs; i++)
  1356. {
  1357. PrintSentinel(this._aDoc[i]._strDoc, fRecursionOK);
  1358. }
  1359. }
  1360. function CPrintDoc_BuildAllLinkedDocuments()
  1361. {
  1362. var strURL = this._aaRect[1][0].contentDocument.URL;
  1363. var aLinks = this._aaRect[1][0].contentDocument.links;
  1364. var nLinks = aLinks.length;
  1365. var i;
  1366. var j;
  1367. var strLink;
  1368. for (i = 0; i < nLinks; i++)
  1369. {
  1370. strLink = aLinks[i].href;
  1371. if ( (strURL == strLink)
  1372. || UnprintableURL(strLink) )
  1373. continue;
  1374. for (j = 0; j < i; j++)
  1375. {
  1376. if (strLink == aLinks[j].href)
  1377. break;
  1378. }
  1379. if (j < i)
  1380. continue;
  1381. this.CreateSubDocument(strLink, false);
  1382. }
  1383. }
  1384. function OnBuildAllFrames( strDoc )
  1385. {
  1386. if ( !g_aDocTree[strDoc]
  1387. || !g_aDocTree[strDoc]._aaRect[1][0]
  1388. || !g_aDocTree[strDoc]._aaRect[1][0].contentDocument.body)
  1389. {
  1390. window.setTimeout("OnBuildAllFrames('" + strDoc + "');", 100);
  1391. return;
  1392. }
  1393. g_aDocTree[strDoc].BuildAllFrames();
  1394. }
  1395. function IsPersistedDoc()
  1396. {
  1397. return (!!g_aDocTree["C"]._aaRect[1][0].contentDocument.all.tags("HTML")[0].__IE_DisplayURL);
  1398. }
  1399. function CPrintDoc_BuildAllFrames()
  1400. {
  1401. var aFrames = this._aaRect[1][0].contentDocument.all.tags("FRAME");
  1402. var nFrames = aFrames.length;
  1403. var nActive = parseInt(this._aaRect[1][0].contentDocument.all.tags("HTML").item(0).__IE_ActiveFrame);
  1404. var i;
  1405. var strSrc;
  1406. var strDoc;
  1407. if (nFrames > 0)
  1408. this._fFrameset = true;
  1409. for (i = 0; i < nFrames; i++)
  1410. {
  1411. strSrc = aFrames[i].src;
  1412. if (strSrc == "res://SHDOCLC.DLL/printnof.htm")
  1413. continue;
  1414. strDoc = this.CreateSubDocument(strSrc, true);
  1415. if (i == nActive)
  1416. g_strActiveFrame = strDoc;
  1417. g_nFramesLeft++;
  1418. OnBuildAllFrames(strDoc);
  1419. }
  1420. g_nFramesLeft--;
  1421. if (g_nFramesLeft <= 0)
  1422. BuildAllFramesComplete();
  1423. }
  1424. function CPrintDoc_CreateSubDocument( docURL, fUseStreamHeader )
  1425. {
  1426. if (!this._aDoc)
  1427. this._aDoc = new Array();
  1428. var nDoc = this._aDoc.length;
  1429. var strDoc = this._strDoc + "_" + nDoc;
  1430. CreateDocument(docURL, strDoc, fUseStreamHeader);
  1431. this._aDoc[nDoc] = g_aDocTree[strDoc];
  1432. return (strDoc);
  1433. }
  1434. function CPrintDoc_AddTableOfLinks()
  1435. {
  1436. ;
  1437. if (!g_fTableOfLinks)
  1438. {
  1439. this._nStatus = 3;
  1440. ChangeDispPage(g_nDispPage);
  1441. this.FixupHF();
  1442. }
  1443. else
  1444. {
  1445. var oTableOfLinks = BuildTableOfLinks(this._aaRect[1][0].contentDocument);
  1446. if (oTableOfLinks != null)
  1447. {
  1448. var oBody = oTableOfLinks.body;
  1449. this.AddFirstPage()
  1450. this._aaRect[this._nStatus][0].contentSrc = oBody.document;
  1451. }
  1452. else
  1453. {
  1454. this._nStatus = 3;
  1455. ChangeDispPage(g_nDispPage);
  1456. this.FixupHF();
  1457. }
  1458. }
  1459. }
  1460. function OnTickHF( strDoc )
  1461. {
  1462. if (!g_aDocTree[strDoc])
  1463. {
  1464. HandleError("Document " + strDoc + " does not exist.", document.URL, "OnRectComplete");
  1465. return;
  1466. }
  1467. g_aDocTree[strDoc].TickHF();
  1468. }
  1469. function CPrintDoc_TickHF()
  1470. {
  1471. var i, j;
  1472. var iTo, jTo;
  1473. var aTok;
  1474. var oTok;
  1475. var nStartPage = this._nNextHF;
  1476. var cPages = this.Pages();
  1477. iTo = nStartPage + 2;
  1478. if (iTo > cPages)
  1479. iTo = cPages;
  1480. for (i = nStartPage; i <= iTo; i++)
  1481. {
  1482. aTok = this.Page(i).children[0].getElementsByTagName("SPAN");
  1483. for (j=0, jTo = aTok.length; j < jTo; j++)
  1484. {
  1485. oTok = aTok[j];
  1486. if (oTok.className == "hfPageTotal")
  1487. oTok.innerText = cPages;
  1488. else if ( oTok.className == "hfUrl"
  1489. && oTok.innerText == "" )
  1490. oTok.innerText = this.EnsureURL();
  1491. else if ( oTok.className == "hfTitle"
  1492. && oTok.innerText == "" )
  1493. oTok.innerText = this.EnsureTitle();
  1494. }
  1495. }
  1496. this._nNextHF = i;
  1497. if (iTo == cPages)
  1498. {
  1499. this._nStatus = 4;
  1500. if (--g_nDocsToCalc == 0)
  1501. CalcDocsComplete();
  1502. }
  1503. else
  1504. {
  1505. this._nTimerHF = window.setTimeout("OnTickHF('" + this._strDoc + "');", 250);
  1506. }
  1507. }
  1508. function CPrintDoc_FixupHF()
  1509. {
  1510. ;
  1511. this.TickHF();
  1512. }
  1513. function CPrintDoc_Pages()
  1514. {
  1515. var i;
  1516. var c;
  1517. for (i = 0, c = 0; i < 3; i++)
  1518. {
  1519. c += this._acPage[i];
  1520. }
  1521. return c;
  1522. }
  1523. function CPrintDoc_Page(nPage)
  1524. {
  1525. var i;
  1526. var n = nPage;
  1527. if (n <= 0)
  1528. return null;
  1529. for (i = 0; i < 3; i++)
  1530. {
  1531. if (n <= this._acPage[i])
  1532. return this._aaPage[i][n - 1].parentElement;
  1533. n -= this._acPage[i];
  1534. }
  1535. return null;
  1536. }
  1537. function CPrintDoc_EnsureURL()
  1538. {
  1539. if (this._strURL == null)
  1540. {
  1541. if ( this._aaRect[1][0]
  1542. && this._aaRect[1][0].contentDocument)
  1543. {
  1544. this._strURL = this._aaRect[1][0].contentDocument.URL;
  1545. }
  1546. if (this._strURL == null)
  1547. return "";
  1548. }
  1549. return this._strURL;
  1550. }
  1551. function CPrintDoc_EnsureTitle()
  1552. {
  1553. if (this._strTitle == null)
  1554. {
  1555. if ( this._aaRect[1][0]
  1556. && this._aaRect[1][0].contentDocument)
  1557. {
  1558. this._strTitle = this._aaRect[1][0].contentDocument.title;
  1559. }
  1560. if (this._strTitle == null)
  1561. return "";
  1562. }
  1563. return this._strTitle;
  1564. }
  1565. function CPrintDoc_ResetDocument()
  1566. {
  1567. var i;
  1568. for (i = 0; i < 3; i++)
  1569. {
  1570. this._acPage[i] = 0;
  1571. if (this._aaRect[i][0])
  1572. this._aaRect[i][0].contentSrc = "";
  1573. }
  1574. this.StopFixupHF();
  1575. }
  1576. function CPrintDoc_ResetTableOfLinks()
  1577. {
  1578. if (this._nStatus <= 2)
  1579. return;
  1580. this.StopFixupHF();
  1581. this._nStatus = 2;
  1582. this.AddTableOfLinks();
  1583. }
  1584. function CPrintDoc_StopFixupHF()
  1585. {
  1586. if (this._nTimerHF != -1)
  1587. window.clearTimeout(this._nTimerHF);
  1588. this._nTimerHF = -1;
  1589. this._nNextHF = 1;
  1590. }
  1591. function CPrintDoc( nDocNum, strDocURL )
  1592. {
  1593. var i;
  1594. this._aDoc = null;
  1595. this._strDoc = nDocNum;
  1596. this._strDocURL = strDocURL;
  1597. this._nStatus = 0;
  1598. this._aaPage = new Array(3);
  1599. this._aaRect = new Array(3);
  1600. this._acPage = new Array(3);
  1601. this._anMerge = new Array(3);
  1602. for (i=0; i<3; i++)
  1603. {
  1604. this._aaPage[i] = new Array();
  1605. this._aaRect[i] = new Array();
  1606. this._acPage[i] = 0;
  1607. this._anMerge[i] = 0;
  1608. }
  1609. this._nNextHF = 1;
  1610. this._nTimerHF = -1;
  1611. this._strURL = null;
  1612. this._strTitle = null;
  1613. this._fFrameset = false;
  1614. this._nStartingPage = 0;
  1615. }
  1616. CPrintDoc.prototype.RectComplete = CPrintDoc_RectComplete;
  1617. CPrintDoc.prototype.AddPage = CPrintDoc_AddPage;
  1618. CPrintDoc.prototype.AddFirstPage = CPrintDoc_AddFirstPage;
  1619. CPrintDoc.prototype.AddTableOfLinks = CPrintDoc_AddTableOfLinks;
  1620. CPrintDoc.prototype.FixupHF = CPrintDoc_FixupHF;
  1621. CPrintDoc.prototype.StopFixupHF = CPrintDoc_StopFixupHF;
  1622. CPrintDoc.prototype.TickHF = CPrintDoc_TickHF;
  1623. CPrintDoc.prototype.InitDocument = CPrintDoc_InitDocument;
  1624. CPrintDoc.prototype.ResetDocument = CPrintDoc_ResetDocument;
  1625. CPrintDoc.prototype.ResetTableOfLinks = CPrintDoc_ResetTableOfLinks;
  1626. CPrintDoc.prototype.BuildAllLinkedDocuments = CPrintDoc_BuildAllLinkedDocuments;
  1627. CPrintDoc.prototype.BuildAllFrames = CPrintDoc_BuildAllFrames;
  1628. CPrintDoc.prototype.CreateSubDocument = CPrintDoc_CreateSubDocument;
  1629. CPrintDoc.prototype.Print = CPrintDoc_Print;
  1630. CPrintDoc.prototype.PrintAllSubDocuments = CPrintDoc_PrintAllSubDocuments;
  1631. CPrintDoc.prototype.ReadyToPrint = CPrintDoc_ReadyToPrint;
  1632. CPrintDoc.prototype.Page = CPrintDoc_Page;
  1633. CPrintDoc.prototype.Pages = CPrintDoc_Pages;
  1634. CPrintDoc.prototype.EnsureURL = CPrintDoc_EnsureURL;
  1635. CPrintDoc.prototype.EnsureTitle = CPrintDoc_EnsureTitle;
  1636. </SCRIPT>
  1637. </HEAD>
  1638. <BODY onload="setTimeout('OnLoadBody()', 400);">
  1639. <!-- Controls for printing -->
  1640. <IE:TemplatePrinter id=Printer />
  1641. <IE:HeaderFooter id=HeadFoot />
  1642. <DIV id=idDivToolbar style="width:100%; overflow:hidden;">
  1643. <DIV style="width=100%; border:'thin threedhighlight groove';">
  1644. <TABLE><TR>
  1645. <TD class="UIPane"> <BUTTON id="butPrint" title="Print Document (Alt+P)" accesskey=p><U>P</U>rint...</BUTTON></TD>
  1646. <TD class="UISeparator"><IMG width=0 height=0></TD>
  1647. <TD class="UIPane"> <BUTTON id="butPageSetup" accesskey=u><IMG id="printCtl" src="printctl.gif" alt="Page Setup (Alt+U)"></BUTTON></TD>
  1648. <TD class="UISeparator"><IMG width=0 height=0></TD>
  1649. <TD class="UIPane"> <BUTTON id="butFirstPage"><IMG id="begin" src="begin_inactive.gif" alt="First Page (Alt+Home)"></BUTTON></TD>
  1650. <TD class="UIPane"> <BUTTON id="butBackPage"> <IMG id="prev" src="prev_inactive.gif" alt="Previous Page (Alt+LeftArrow)"></BUTTON></TD>
  1651. <TD class="UIPane"><SPAN style="color:windowtext;"><NOBR Loc> <ID id=idTdPageXofYLocText1>P<U>a</U>ge</ID> <INPUT type=text id="inputPageNum" title="Preview Page (Alt+A)" value="1" style="height:1.5em; width: 2em; color:windowtext;" accesskey=a><ID id=idTdPageXofYLocText2> of </ID><SPAN id="spanPageTotal"></SPAN>
  1652.  </SPAN></NOBR></TD>
  1653. <TD class="UIPane"> <BUTTON id="butNextPage"> <IMG id="next" src="next_inactive.gif" alt="Next Page (Alt+RightArrow)"></BUTTON></TD>
  1654. <TD class="UIPane"> <BUTTON id="butLastPage"> <IMG id="end" src="end_inactive.gif" alt="Last Page (Alt+End)"></BUTTON></TD>
  1655. <TD class="UISeparator"><IMG width=0 height=0></TD>
  1656. <TD class="UIPane"> <BUTTON id="butZoomOut"> <IMG id="zoomOut" base="zoomOut" src="zoomout.gif" alt="Zoom Out (Alt+Minus)"></BUTTON></TD>
  1657. <TD class="UIPane"> <BUTTON id="butZoomIn"> <IMG id="zoomIn" base="zoomIn" src="zoomin.gif" alt="Zoom In (Alt+Plus)"></BUTTON></TD>
  1658. <TD class="UIPane"> <SELECT id="selectZoom" accesskey=z>
  1659. <OPTION VALUE="500" >500%
  1660. <OPTION VALUE="200" >200%
  1661. <OPTION VALUE="150" >150%
  1662. <OPTION VALUE="100" >100%
  1663. <OPTION VALUE="75" SELECTED >75%
  1664. <OPTION VALUE="50" >50%
  1665. <OPTION VALUE="25" >25%
  1666. <OPTION VALUE="10" >10%
  1667. <!-- ID's are for localization -->
  1668. <OPTION VALUE="-1" id="idPageWidth">Page Width</OPTION>
  1669. <OPTION VALUE="-2" id="idWholePage">Whole Page</OPTION>
  1670. <OPTION VALUE="-3" id="idTwoPages" >Two Pages </OPTION>
  1671. </SELECT></TD>
  1672. <TD class="UISeparator" id="separatorFrameset" style="display:none"><IMG width=0 height=0></TD>
  1673. <TD class="UIPane" id="cellFrameset" style="display:none"> <SELECT id="selectFrameset" accesskey=f>
  1674. <OPTION VALUE="0" id="idLaidOut">As laid out on screen</OPTION>
  1675. <OPTION VALUE="1" id="idSelected">Only the selected frame</OPTION>
  1676. <OPTION VALUE="2" id="idSeparate">All frames individually</OPTION>
  1677. </SELECT></TD>
  1678. <TD class="UISeparator"><IMG width=0 height=0></TD>
  1679. <TD class="UIPane"> <BUTTON id="butHelp" title="Print Preview Help (Alt+H)" accesskey=h><U>H</U>elp</BUTTON></TD>
  1680. <TD class="UISeparator"><IMG width=0 height=0></TD>
  1681. <TD class="UIPane"> <BUTTON id="butClose" title="Close Print Preview (Alt+C)" accessKey=c><U>C</U>lose</BUTTON></TD>
  1682. </TR></TABLE>
  1683. </DIV>
  1684. </DIV>
  1685. <DIV id=OverflowContainer onclick="this.focus();" onfocus="butPrint.scrollIntoView();" tabindex=1 style="position:absolute; left:0; width:100%; overflow:auto; border:'thin threedhighlight inset'; background:threedshadow;">
  1686. <DIV id=MasterContainer tabindex=0 style="width:100%; position:absolute;">
  1687. <!-- Pages go here -->
  1688. </DIV>
  1689. </DIV>
  1690. </BODY>
  1691. </HTML>
  1692.